const {insertData} = require('./common');
// const {circum} = require('../../src/circum_生活周边');

const {iphone} = require('../../src/iphone_手机');

(async () => {
    let dataArr_1 = await iphone();
    let len_1 = dataArr_1.length - 1;
    dbInsert(dataArr_1,len_1,'iphones','iphone');
})();



function dbInsert(dataArr,len,clitions,id) {
    insertData(clitions).then(model => {
        dataArr.forEach((item, index) => {
            model.create({
                imgUrl: item.imgUrl,
                imgWrap: item.imgWrap,
                DeviceNmae: item.DeviceNmae,
                describe: item.describe,
                price: item.price,
                id: `2018_${id}_${index}`,
                checked: 0,
                sort: index
            })
            if (index === len) {
                console.log('插入数据完成')
            }
        })
    });
}


